package dataAccessLayer.abstractFactory;

import java.util.ResourceBundle;

import dataAccessLayer.abstractFactory.daos.DAOcities;
import dataAccessLayer.abstractFactory.daos.DAOcustomers;
import dataAccessLayer.abstractFactory.daos.DAOsalesDetail;
import dataAccessLayer.abstractFactory.daos.DAOingredients;
import dataAccessLayer.abstractFactory.daos.DAOrecipesIngredients;
import dataAccessLayer.abstractFactory.daos.DAOpies;
import dataAccessLayer.abstractFactory.daos.DAOrecipes;
import dataAccessLayer.abstractFactory.daos.DAOusers;
import dataAccessLayer.abstractFactory.daos.DAOsales;

public abstract class Factory 
{
	public static Factory factory;
	
	public static Factory getInstance()
	{
		if (factory != null)
		{
			return factory;
		}
		
		String factoryName;
		factoryName = ResourceBundle.getBundle("dataAccessLayer.dataAccess").getString("factory");
		Class<?> factoryInstance;
		
		try 
		{
			factoryInstance = Class.forName(factoryName);
			factory = (Factory) factoryInstance.newInstance();
			 
		} 
		catch (ClassNotFoundException e) 
		{
			e.printStackTrace();
		}
		catch (InstantiationException e) 
		{
			e.printStackTrace();
		}
		catch (IllegalAccessException e) 
		{
			e.printStackTrace();
		}
		
		return factory;
	}
	
	public abstract DAOcustomers getDAOcustomers();
	
	public abstract DAOingredients getDAOingredients();
	
	public abstract DAOpies getDAOpies();
	
	public abstract DAOrecipes getDAOrecipes();
	
	public abstract DAOusers getDAOusers();
	
	public abstract DAOsales getDAOsales();
	
	public abstract DAOcities getDAOcities();
	
	public abstract DAOsalesDetail getDAOsalesDetail();
	
	public abstract DAOrecipesIngredients getDAOrecipesIngredients();
}
